<?php
/**
 * Created by PhpStorm.
 * User: js
 * Date: 2018/10/10
 * Time: 14:14
 */

namespace app\modules\api\models;


use app\models\LiveIndex;

class CloseLiveForm extends Model
{

    public $status;
    public $wechat_app_id;

    public function rules()
    {
        return [
            [['status','wechat_app_id',], 'required',],
        ];
    }

    public function save()
    {
        if (!$this->validate())
            return $this->getModelError();
        $res = LiveIndex::updateAll(['status' => 0], [
            'wechat_app_id' => \yii::$app->request->get('wechat_app_id'),
        ]);
        if ($res)
            return [
                'code' => 0,
                'msg' => 'success',
            ];
        else
            return [
                'code' => 1,
                'msg' => 'fail',
            ];
    }
}
{

}